
export default {

  moneyFormate(number, places, symbol, thousand, decimal) {
    number = number || 0;
    places = !isNaN(places = Math.abs(places)) ? places : 2;
    symbol = symbol !== undefined ? symbol : '¥';
    thousand = thousand || ',';
    decimal = decimal || '.';
    var negative = number < 0 ? '-' : '',
      i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + '',
      j = (j = i.length) > 3 ? j % 3 : 0;
    return symbol + negative + (j ? i.substr(0, j) + thousand : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : '');
  },

  //获取用户类型
  getUserByType(userType) {

    let userTypename = '';

    if(userType == 'YX#') {
      userTypename = '意向客户'
    } else if(userType == 'YB#') {
      userTypename = '一般客户'
    } else if(userType == 'YCJ') {
      userTypename = '已成交客户'
    } else if(userType == 'WX#') {
      userTypename = '未知来源'
    } else if(userType == 'QT#') {
      userTypename = '其它'
    } else {
      userTypename = '未知来源'
    }

    return userTypename;
  },

  getStatename(state){

    let statename = '';

    if(state== 'INT') {
      statename = '初步接洽'
    } else if(state=='XQ#') {
      statename = '需求确定';
    } else if(state=='FA#') {
      statename = '已成交客户';
    } else if(state=='TP#') {
      statename = '无效客户';
    } else if(state=='CJ#') {
      statename = '其它客户';
    } else {
      statename = '其它客户'
    }

    return statename;
  },


  getFollowStatename(state){

    let statename = '';

    if(state == 'DH#') {
      statename = '电话跟进'
    } else if(state == 'DF#') {
      statename = '到访跟进';
    } else {
      statename = '未知跟进'
    }

    return statename;

  },

  getParentname(name) {
    return name ? name: '未知名称'
  },
  getTime(time) {
    return time ? time : '无跟进时间'
  },
  safeNickName(name) {
    return name.length > 10 ? name.substr(0, 8)+'...' : name;
  },
  babyGroupPrefix(babyname) {
    return '宝宝：' + (babyname ? babyname : '');
  },

  getUserSource(source) {
    return '未知来源'
  }

}
